package tcp.request;

import java.io.File;

public class UploadRequest extends Request{


	private File fileDescriptor;
	private byte[] uploadData;
	private boolean canUpload;
	
	public UploadRequest(String hostname, int portNumber, File fileToUpload) {
		super(hostname, portNumber);
		this.fileDescriptor = fileToUpload;
		this.canUpload = false;
	}

	public File getFileToUpload(){
		return this.fileDescriptor;
	}
	public void setUploadData(byte[] data){
		uploadData = new byte[data.length];
		for(int i = 0; i < data.length; i++){
			uploadData[i] = data[i];
		}
		this.canUpload = true ;
	}
	public byte[] getUploadData(){
		return (this.canUpload)?(this.uploadData):(new byte[0]);
	}
	
}
